0c3209b773d98ebe45631a9001a5363b9e753cd1,src/freenet/support/RandomGrabArray.java,RandomGrabArray,removeRandomExhaustiveSearch,#RandomGrabArrayItemExclusionList#ObjectContainer#ClientContext#number#,273

Before Change


				ret = validItem;
				if(logMINOR) Logger.minor(this, "No valid or excluded items apart from "+ret+" total "+index);
				if(persistent && changedMe) {
					container.store(blocks[0]);
					container.store(this);
				}
				return new RemoveRandomReturn(ret);

After Change


				ret = chosenItem;
				if(logMINOR) Logger.minor(this, "Chosen random item "+ret+" out of "+valid+" total "+index);
				if(persistent && changedMe) {
					container.store(blocks[blockNumReading]);
					if(blockNumReading != blockNumWriting)
						container.store(blocks[blockNumWriting]);
					container.store(this);
				}
				return new RemoveRandomReturn(ret);
			}
			if(valid == 0 && exclude == 0) {
				index = 0;
				if(persistent) {
					if(blocks.length != 0)
						blocks = new Block[] { blocks[0] };
					container.store(blocks[0]);
					container.store(this);
				}
				if(logMINOR) Logger.minor(this, "No valid or excluded items total "+index);
				return null; // Caller should remove the whole RGA
			} else if(valid == 0) {
				if(persistent && changedMe) {
					container.store(blocks[blockNumReading]);
					if(blockNumReading != blockNumWriting)
						container.store(blocks[blockNumWriting]);
					container.store(this);
				}
				if(logMINOR) Logger.minor(this, "No valid items, "+exclude+" excluded items total "+index);
				context.cooldownTracker.setCachedWakeup(wakeupTime, this, parent, persistent, container);
				return new RemoveRandomReturn(wakeupTime);
			} else if(valid == 1) {
				ret = validItem;
				if(logMINOR) Logger.minor(this, "No valid or excluded items apart from "+ret+" total "+index);
				if(persistent && changedMe) {
					container.store(blocks[blockNumReading]);
					if(blockNumReading != blockNumWriting)
						container.store(blocks[blockNumWriting]);
					container.store(this);
				}
				return new RemoveRandomReturn(ret);